package Book;

/**
 * Creat with IntelliJ IDEA
 * Description
 * User: mamba24
 * Date: 2022-04-12
 * Time: 8:06
 * To BE A Better Person-2020-3-2
 */
public class Book {
    private String name;//书名
    private String author;//作者
    private int price;//价格
    private String type;//类型
    private boolean isBorrowed;//是否被借出

    public Book(String name, String author, int price, String type) {
        this.name = name;
        this.author = author;
        this.price = price;
        this.type = type;
        this.isBorrowed=true;
    }



    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public void setBorrowed(boolean borrowed) {
        isBorrowed = borrowed;
    }

    public boolean isBorrowed() {
        return isBorrowed;
    }



    @Override
    public String toString() {
        if(isBorrowed==true) {
            return "Book{" +
                    "书名>:'" + name + '\'' +
                    ", 作者>:" + author + '\'' +
                    ", 价格>:" + price +
                    ", 种类>:" + type + '\'' +
                    ", 状态>:未借出" +
                    '}';
        }else{
            return  "Book{" +
                    "书名>:'" + name + '\'' +
                    ", 作者>:" + author + '\'' +
                    ", 价格>:" + price +
                    ", 种类>:" + type + '\'' +
                    ", 状态>:已借出"  +
                    '}';
        }
    }
}
